<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>微信抢楼</title>
	<meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
	<link href="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/css/activity-style.css" rel="stylesheet" type="text/css">
<style type="text/css">
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, a, blockquote, th,i,u {margin:0;padding:0;border:0;}
h1, h2, h3, h4, h5, h6 {font-size:100%;}
ol, ul {list-style:none;}
u, i {font-size:12px; font-weight:normal; font-style:normal;}
table {border-collapse:collapse; border-spacing:0px;}
fieldset,img {border:0;}
html {width:100%; height:100%;}
body{width:100%; height:100%; color:#000;background:#fff;font:12px Verdana,Arial,sans-serif,"Times New Roman",'微软雅黑';}

/*清除浮动*/
.clearfix:after {content:".";display:block;height:0;clear:both; visibility:hidden;}
.clearfix {display:inline-block;}
a{ text-decoration:none;}
a:hover{ text-decoration:underline; color:#000000}
A:link{text-decoration:none} 

/* Hides from IE-mac \*/
* html .clearfix {height:1%;}
.clearfix {display:block;}
/* End hide from IE-mac */
.window {
width:267px;
position:absolute;
display:none;
margin:0px auto 0 -136px;
padding:2px;
top:80px;
height:200px;
left:50%;
border-radius:0.6em;
-webkit-border-radius:0.6em;
-moz-border-radius:0.6em;
background-color: #f1f1f1;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
-o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
font:14px/1.5 Microsoft YaHei, Helvitica, Verdana, Arial, san-serif;
z-index:10;
bottom: auto;
}
.window .wtitle {
background-color: #585858;
line-height: 26px;
padding: 5px 5px 5px 10px;
color:#ffffff;
font-size:16px;
border-radius:0.5em 0.5em 0 0;
-webkit-border-radius:0.5em 0.5em 0 0;
-moz-border-radius:0.5em 0.5em 0 0;
}
.window .content {
/*min-height:100px;*/
overflow:auto;
padding:10px;
background: linear-gradient(#FBFBFB, #EEEEEE) repeat scroll 0 0 #FFF9DF;
color: #222222;
text-shadow: 0 1px 0 #FFFFFF;
border-radius: 0 0 0.6em 0.6em;
-webkit-border-radius: 0 0 0.6em 0.6em;
-moz-border-radius: 0 0 0.6em 0.6em;
}
.window #txt {
min-height:30px;
font-size:14px;
line-height:20px;
}
.window .content p {
margin:10px 0 0 0;
}
.window .txtbtn {
color: #666666;
font-weight: bold;
text-shadow: 0 1px 0 #FFFFFF;
display: block;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
text-align: windowcenter;
font-weight: bold;
font-size: 16px;
padding:8px;
margin:10px 0 0 0;
background-color:#F4F4F4;
border:1px solid #C6C6C6;
background-image: linear-gradient(bottom, #E1E1E1 0%, #ffffff 100%);
background-image: -o-linear-gradient(bottom, #E1E1E1 0%, #ffffff 100%);
background-image: -moz-linear-gradient(bottom, #E1E1E1 0%, #ffffff 100%);
background-image: -webkit-linear-gradient(bottom, #E1E1E1 0%, #ffffff 100%);
background-image: -ms-linear-gradient(bottom, #E1E1E1 0%, #ffffff 100%);
background-image: -webkit-gradient(  linear,  left bottom,  left top,  color-stop(0, #E1E1E1),  color-stop(1, #ffffff)  );
-webkit-box-shadow: 0 1px 0 #FFFFFF inset, 0 1px 0 #EEEEEE;
-moz-box-shadow: 0 1px 0 #FFFFFF inset, 0 1px 0 #EEEEEE;
box-shadow: 0 1px 0 #FFFFFF inset, 0 1px 0 #EEEEEE;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.window .txtbtn:visited {
background-image: linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -o-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -moz-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -webkit-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -ms-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -webkit-gradient(  linear,  left bottom,  left top,  color-stop(0, #ffffff),  color-stop(1, #E1E1E1)  );
}
.window .txtbtn:active {
background-image: linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -o-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -moz-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -webkit-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -ms-linear-gradient(bottom, #ffffff 0%, #E1E1E1 100%);
background-image: -webkit-gradient(  linear,  left bottom,  left top,  color-stop(0, #ffffff),  color-stop(1, #E1E1E1)  );
}
.window .wtitle .close {
float:right;
background-image: url("");
width:26px;
height:26px;
display:block;
}
#mcover{ position: fixed;	top:0;	left:0;	width:100%;	height:100%;background:rgba(0, 0, 0, 0.7);	display:none;z-index:20000;}
#mcover img {position: fixed;right: 18px;top:5px;width: 260px;height: 180px;z-index:20001;}
</style>
	<link href="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/css/style.css" rel="stylesheet" type="text/css">
	<link type="text/css" rel="stylesheet" href="../addons":"./source/modules"}/bm_floor/template/css/font-awesome.min.css" />
	<script type="text/javascript" src="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/js/alert.js"></script>
	<script type="text/javascript">
	$(function(){
		countDown("{php echo date('Y-m-d', strtotime($pan['endtime']))}","#colockbox1");
	});
	function countDown(time,id){
		var day_elem = $(id).find('.day');
		var hour_elem = $(id).find('.hour');
		var minute_elem = $(id).find('.minute');
		var second_elem = $(id).find('.second');
		var end_time = new Date(time).getTime(),//月份是实际月份-1
		sys_second = (end_time-new Date().getTime())/1000;
		var timer = setInterval(function(){
			if (sys_second > 1) {
				sys_second -= 1;
				var day = Math.floor((sys_second / 3600) / 24);
				var hour = Math.floor((sys_second / 3600) % 24);
				var minute = Math.floor((sys_second / 60) % 60);
				var second = Math.floor(sys_second % 60);
				day_elem && $(day_elem).text('剩余时间：'+day+'天');//计算天
				$(hour_elem).text(hour<10?"0"+hour+'小时':hour+'小时');//计算小时
				$(minute_elem).text(minute<10?"0"+minute+'分':minute+'分');//计算分钟
				$(second_elem).text(second<10?"0"+second+'秒':second+'秒');//计算秒杀
			} else { 
				$('#colockbox1').text('该活动已经结束');
			}
		}, 1000);
	}
</script>
</head>

<body class="activity-coupon-winning">
<div id="mcover" onClick="document.getElementById('mcover').style.display='';"><img src="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/images/121.png"></div>
<div id="normalG">
    <div id="wrap">
        <div class="zi"><img src="{php echo IMS_VERSION>=0.6?"../addons":"./source/modules"}/bm_floor/template/images/zi.png"></div>
	   <form action="{php echo $this->createMobileUrl('ajaxGetUser', array('do' => 'ajaxGetUser', 'name' => 'bm_floor', 'rid' => $rid, 'weid' => $pan['weid'], 'from_user' => $_GPC['from_user']))}" method="post">
	   <div class="window" id="windowcenter">
			<div id="title" class="wtitle">请先完善您的信息<span class="close" id="alertclose"></span></div>
			<div class="content">
				<div id="txt">请提交您的姓名和手机号码</div>
				<p>
				<input name="username"  class="px" id="username"  type="text" placeholder="请输入您的姓名">
				</p>
				<p>
				<input name="mobile"  class="px" id="mobile"   type="text" placeholder="请输入您的电话">
				</p>
				<input type="hidden" name="weid" value="{$weid}">
				<input type="hidden" name="rid" value="{$rid}">
				<input type="submit" name="submit" class="txtbtn" value="确定" id="windowclosebutton">
			</div>
		</div>
		</form>
        <div class="frame">
            <div class="frameCon"><img src="{$_W['attachurl']}{$pan['share_logo']}" alt=""></div>
        </div>			
        <div class="frameBtn clearfix">
            <span class="b2"><a href="{$pan['adv_url']}">查看原文</a><i class="icon icon-angle-right"></i></span>
            <span class="b1" id="forward_btn"><i class="icon icon-mail-forward"></i>点我报名 再转发朋友圈</span>
        </div>
        <div class="turnTime" id="colockbox1"><span class="day">00</span> <span class="hour">00</span> <span class="minute">00</span> <span class="second">00</span> </div>
        <div class="turnBox rule">
            <h2>活动规则</h2>
            <div class="boxCon">{php echo htmlspecialchars_decode($pan['share_statement'])}</div>
        </div>
        <div class="turnBox rank">
            <h2>转发排名<i class="icon icon-repeat"></i></h2>
            <div class="boxCon">
                <div class="rankMe">{if $state==0} 您还未参与活动,{else}我当前排第 <span class="rankNUM">{$orderNum}</span> 名,{/if}共<span class="rankNUMS">{$total}</span>人参与</div>
                <div class="rankList">
                    <table>
                        <thead>
                        <tr>
                            <th>排名</th>
                            <th>姓名</th>
                            <th>手机号</th>
                            <th>点击数</th>
                        </tr>
                        </thead>
                        <tbody>
						{loop $list $row}
						{php $i++;}
						<tr><td>{$i}</td><td>{$row['realname']}</td><td>{php echo $this->hidtel($row['mobile'])}</td><td>{$row['share_point']}</td></tr>
						{/loop}
						</tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$(".b1").click(function(){
		var states = "{$state}";
		if(states=="0"){
			$(".window").slideDown(500);
		}else{
			document.getElementById('mcover').style.display='block';
		}
	});
	$(".close").click(function(){	
		$(".window").slideUp(500);
	});
	$("#windowclosebutton").bind("click", function () {
			var btn = $(this);
			if($("#username").val()==''){
				$("#txt").html("必须填写真实姓名!");
				
			}
			if($("#mobile").val()==''){
				$("#txt").html("手机号不对或为空!");
				
			}
			reg=/^0{0,1}(13[0-9]|145|15[7-9]|153|156|18[0-9])[0-9]{8}$/i;
			if(!reg.test($("#mobile").val())){   
				$("#txt").html("请输入11位有效号码!");
				
			 }
	});
	
})
</script>
<?php
require_once IA_ROOT."/jssdk.class.php";//注意这里要填写绝对路径
$weixin = new jssdk($jie='1',$url='');//借用传入0或1,url是地址默认不借用,当前地址
$wx = $weixin->get_sign();
?>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>           
<script type="text/javascript">
  wx.config({
      appId: "{$wx['appId']}",
      timestamp: {$wx['timestamp']},
      nonceStr: "{$wx['nonceStr']}",
      signature: "{$wx['signature']}",
      jsApiList: [
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onRecordEnd',
        'playVoice',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
      ]
  });
  wx.ready(function () {
    var shareData = {
    title: '欢迎参加微信抢楼活动',
    desc: '{$pan['share_memo']}',
    link: "{$staturl}",
    imgUrl: "{$imgurl}",
  };
  //分享朋友
  wx.onMenuShareAppMessage({
      title: shareData.title,
      desc: shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
      alert("分享成功，请朋友帮点击帮你赚取更多抢楼机会吧！");
      },
      cancel: function (res) {
	  alert("分享后可以获得更多抢楼机会哦！");
      },
      fail: function (res) {
        alert("分享失败，可能是网络问题，一会儿再试试？");
      }
    });
 //朋友圈
  wx.onMenuShareTimeline({
      title: shareData.title+"---"+shareData.desc,
      link: shareData.link,
      imgUrl:shareData.imgUrl,
      trigger: function (res) {
      },
      success: function (res) {
          window.location.href =adurl;
      },
      cancel: function (res) {
      },
      fail: function (res) {
        alert(JSON.stringify(res));
      }
    });   
    
  });
</script>
</body>
</html>
